<?php
class IndexAction extends CommonAction {
	public function index()
	{
		$InfoType = D('InfoType');
		$Info = D('Info');
		$map['mid'] = $this->mid;
		$map['show'] = 1;
		$types = $InfoType->_list_($map,1,30);
		$this->assign('types',$types['volist']);

		unset($map);
		$map['slide'] = 1;
		$map['mid'] = $this->mid;
		$infos = $Info->_list_($map,1,30);
		$this->assign('infos',$infos['volist']);
		$this->display($this->tplPath.$this->tplName.'/index.html');
	}

	public function InfoType($id = 0,$page = 1)
	{
		$page = I('page',1);
      	if ($page < 1) $page = 1;

		if ($id == 0) {
			# code...
		}
		$Info = D('Info');
		$InfoType = D('InfoType');
		$vo = $InfoType->find($id);
		if (!$vo) {
			# code...
		}
		$this->assign('vo',$vo);
        $this->initMichome($vo['mid']);

		$map['mid'] = $this->mid;
		$map['mid'] = $vo['mid'];
		$map['show'] = 1;
		$types = $InfoType->_list_($map,1,40);
		$this->assign('types',$types['volist']);
		unset($map);


		$map['mid'] = $vo['mid'];
		$infos = $Info->_list_($map,$page,6);
		$this->assign('infoslist',$infos);
		$this->assign('infos',$infos['volist']);

		$this->assign('npage',$page + 1);
      	$this->assign('ppage',$page - 1);


      	if ($vo['tpl']) {
      		$this->tplName = $vo['tpl'];
      	}
		$this->display($this->tplPath.$this->tplName.'/InfoType.html');
	}



	public function Info($id = 0)
	{
		$Info = D('Info');
		$InfoType = D('InfoType');
		$vo = $Info->find($id);
		if (!$vo) {
			# code...
		}
		$map['id'] = $id;
		$Info->where($map)->setInc('hits');
		unset($map);
		$this->assign('vo',$vo);
        $this->initMichome($vo['mid']);
        $this->initMpaccount($vo['mid']);

        $map['mid'] = $this->mid;
		$map['mid'] = $vo['mid'];
		$map['show'] = 1;
		$types = $InfoType->_list_($map,1,40);
		$this->assign('types',$types['volist']);
		unset($map);

		if ($vo['tpl']) {
      		$this->tplName = $vo['tpl'];
      	}
		$this->display($this->tplPath.$this->tplName.'/Info.html');
	}


}